<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'login.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>static/css/css.css">
	<script type="text/javascript" src="<%=basePath%>static/js/jquery/jquery.js" ></script>
	<script type="text/javascript" src="<%=basePath%>static/js/common/common.js" ></script>
	
	<script type="text/javascript">
		function logins(){
	        ajaxGet("<%=basePath%>app/login/"+$("#loginUser").val(), onSuccess);
        }

		function shows(){
	        ajaxGet("<%=basePath%>app/show?user="+$("#loginUser").val(), onSuccess);
        }
        
        function generates(){
	        ajaxGet("<%=basePath%>app/generate", onSuccess);
        }
		
        function onSuccess(json){
	        alert(json);
         }
	</script>	

  </head>
  
  <body> 
    <form method="post" action="app/add" name="addForm">
	    <table width="800" cellspacing="0" cellpadding="0" border="0" bgcolor="#c0c0c0">
			<tbody>
				<tr><td align="right" width="200px">login name:</td>
					<td width="200px"><input type="text" name="user" value="" /></td>
				</tr>
				<tr>
					<td align="right">login password:</td>
					<td ><input type="password" name="password" value="" /></td>
				</tr>
				<tr>
					<td colspan="2" align="center"><input type="submit" value="submit" /></td>
				</tr>
			</tbody>
		</table>
	</form> 
	<form method="get" name="loginForm">
		<img src="<%=basePath%>static/images/fiest.jpg" height="200px" />
		user:<input type="text" name="user" id="loginUser" value="" />password:<input type="password" id="loginPsw" name="password" value="" />
		<input type="button" value="login" id="login" onclick="logins()" />
		<input type="button" value="show" id="show" onclick="shows()" />
		<input type="button" value="static" id="static" onclick="generates()" />
	</form>
  </body>
 
</html>

